|
|
|
|
|
|
|
RING
DATE = 0417
TIME = 2005
NMBR = 9015551212
NAME = SILER BRIAN
RING |
|
|
|
|
|
|
|
|
|
The format and Caller ID implementation vary from modem to modem. For example, my ISDN modem returns the information in an entirely different manner. Although you can easily modify this program to suit your modem, being familiar with your modem's Caller ID format is imperative.  |
|
|
|
|
|
|
|
|
|
|
After you have determined how to get the Caller ID information from your modem using a terminal session, the next step is to write a Visual Basic application that talks to the modem, receives this information, and takes action based on it. The sample application described in this section issues the command to turn on Caller ID display, and then it repeatedly polls the modem to check for Caller ID data. If any data appears, the program plays the appropriate WAV file. The heart of this program is the Microsoft Communications (MS Comm) Control, which is the component that allows you to talk to the modem from VB. |
|
|
|
|
|
|
|
|
VB Techniques You'll Be Using |
|
|
|
|
|
|
|
|
In addition to the newly covered MS Comm Control, this program brings together some material covered in other chapters of the book: INI files, the Timer control, and API calls. In order to successfully complete this example, you should have a good understanding of each of these concepts. |
|
|
|
|
|
|
|
|
An API call is used to play sounds on the computer's sound card. This specific example is covered in Chapter 20, "Accessing the Windows API." Refer to that chapter if you need help using the sndPlaySound API call. |
|
|
|
|
|
|
|
|
See "Useful API Calls," p. 457 |
|
|
|
|
|
|
|
|
The Timer control, covered in Chapter 4, "Using Visual Basic's Default Controls," is used to initiate the process of checking for Caller ID data. In the sample program, the Timer event is coded with only a single line as follows: |
|
|
|
|
|
|
|
|
Private Sub tmrMain_Timer()
CheckForCall
End Sub |
|
|
|
|
|
|
|
|
CheckForCall is a custom function you will write that checks the modem for new information. |
|
|
|
|
|
|
|
|
See "Special-Purpose Controls," p. 78 |
|
|
|
|
|